package com.sheng.project.study.spring.demo01;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author liusheng
 * @date 2023/07/06
 */
@Configuration
public class ConfigBean {
    // bean 名称为方法默认值：user1
    @Bean
    public User user1() {
        return new User();
    }

    // bean 名称通过 value 指定了：user2Bean
    @Bean("user2Bean")
    public User user2() {
        return new User();
    }

    // bean 名称为：user3Bean，2个别名：[user3BeanAlias1, user3BeanAlias2]
    @Bean({"user3Bean", "user3BeanAlias1", "user3BeanAlias2"})
    public User user3() {
        return new User();
    }
}
